var express = require('express');
var router = express.Router();
var mysql = require("./tool/mysql");
var url = require('url')
/* GET users listing. */
router.get('/', function(req, res, next) {
  mysql.connect(function(db){
    console.log("success-goods");
    var querObj = {};
    var showObj = {
      _id: 0
    };
    // var skipNum = 0;
    // mysql.findSkip(db,"newList",querObj,showObj,skipNum,function(result){
    mysql.find(db,"goods",querObj,showObj,function(result){
      // 拿到数据库数据后返回给页面
        obj ={
          title:"商品列表",
          activeIndex:8,
          isBoss: false,
          result: result,
          sort : 0
        }
        res.render("goods",obj);
        // console.log(result);
        db.close();
    })
  })
  // res.render("list",{title:"锋影-电影列表",activeIndex:1,isBoss: false});
});



module.exports = router;
